using System;
namespace BMC.ARSystem
{
	public class DateValue
	{
		private int year;
		private int month;
		private int day;
		public int Year
		{
			get
			{
				return this.year;
			}
			set
			{
				this.year = value;
			}
		}
		public int Month
		{
			get
			{
				return this.month;
			}
			set
			{
				this.month = value;
			}
		}
		public int Day
		{
			get
			{
				return this.day;
			}
			set
			{
				this.day = value;
			}
		}
		public int JulianDate
		{
			get
			{
				return new Server().DateToJulianDate(this.year, this.month, this.day);
			}
		}
		public DateValue(int year, int month, int day)
		{
			if (year <= -4713 || year == 0 || year > 9999 || month <= 0 || month > 12 || day <= 0 || day > 31)
			{
				throw new ARException(string.Format("DateValue value must values in this range [Year (-4713 to 9999), Month (1-12), Day (1-31)] but specified: ({0},{1},{2}))", year, month, day));
			}
			this.year = year;
			this.month = month;
			this.day = day;
		}
		public DateValue(int julianDate)
		{
			new Server().JulianDateToDate(julianDate, out this.year, out this.month, out this.day);
		}
		public DateValue(DateTime val) : this(val.get_Year(), val.get_Month(), val.get_Day())
		{
		}
		public override string ToString()
		{
			return string.Format("{0}-{1}-{2}{3}", new object[]
			{
				Math.Abs(this.year),
				this.month,
				this.day,
				(this.year < 0) ? " BC" : ""
			});
		}
		public override bool Equals(object obj)
		{
			if (obj == null)
			{
				return false;
			}
			if (base.GetType() != obj.GetType())
			{
				return false;
			}
			DateValue dateValue = (DateValue)obj;
			return dateValue.Year == this.Year && dateValue.Month == this.Month && dateValue.Day == this.Day;
		}
		public bool Equals(DateValue obj)
		{
			return obj != null && (obj.Year == this.Year && obj.Month == this.Month) && obj.Day == this.Day;
		}
		public override int GetHashCode()
		{
			return this.Year.GetHashCode() ^ this.Month.GetHashCode() ^ this.Day.GetHashCode();
		}
	}
}
